SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vwlfamilia
AS
SELECT     dbo.tb_relfamiliaralumno.idrelfamiliaralumno AS ID, dbo.tb_relfamiliaralumno.alumno, dbo.tb_TiposDeDocumento.Descripcion, 
                      dbo.tb_Familia.Documento, dbo.tb_Familia.Apellido, dbo.tb_Familia.Nombres, dbo.tb_Parentezcos.Descripcion AS Parentezco, 
                      dbo.tb_Familia.Domicilio
FROM         dbo.tb_relfamiliaralumno INNER JOIN
                      dbo.tb_Alumnos ON dbo.tb_relfamiliaralumno.alumno = dbo.tb_Alumnos.idAlumno INNER JOIN
                      dbo.tb_Parentezcos ON dbo.tb_relfamiliaralumno.parentezco = dbo.tb_Parentezcos.idParentezco INNER JOIN
                      dbo.tb_Familia INNER JOIN
                      dbo.tb_TiposDeDocumento ON dbo.tb_Familia.TipoDocumento = dbo.tb_TiposDeDocumento.idTipoDocumento ON 
                      dbo.tb_relfamiliaralumno.familiar = dbo.tb_Familia.idFamilia
GO
GRANT SELECT ON  [dbo].[vwlfamilia] TO [Alumnos]
GRANT SELECT ON  [dbo].[vwlfamilia] TO [GestionInstitucional]
GRANT SELECT ON  [dbo].[vwlfamilia] TO [SoloVer]
GO
